<?php

namespace Addons\ArticleToExcel;
use Common\Controller\Addon;

/**
 * 文章导出插件插件
 * @author creatint
 */

    class ArticleToExcelAddon extends Addon{

        public $info = array(
            'name'=>'ArticleToExcel',
            'title'=>'文章导出插件',
            'description'=>'文章导出为表格文件',
            'status'=>1,
            'author'=>'creatint',
            'version'=>'0.1'
        );

        public function install(){
            return true;
        }

        public function uninstall(){
            return true;
        }

        //实现的addButton钩子方法
        public function addButton($param){
            $config = $this->getConfig();
            //获取分类白名单
            $config['categorys'] = explode(',',$config['categorys']);
            //获取当前分类
            $cate_id = I("cate_id",0);
            if(in_array($cate_id,$config['categorys'])){
                //TODO:当前分类在白名单中
//                echo 'in list';
                $this->assign('cate_id',$cate_id);
            }else{
                //TODO:当前分类不在白名单中
//                echo 'not in list';
                return;
            }






            $this->display("button");
        }

    }